package com.platform.apex.util;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

public class ObjectMapperUtil {

	//private final static String locker = "locker";
	private static final Object locker = new Object();
	private static ObjectMapper OBJECT_MAPPER_FOR_ROUTING;

	public static ObjectMapper getObjectMapperForRouting() {
			synchronized (locker) {
				if (OBJECT_MAPPER_FOR_ROUTING == null){
					OBJECT_MAPPER_FOR_ROUTING = new ObjectMapper();
					OBJECT_MAPPER_FOR_ROUTING.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
					OBJECT_MAPPER_FOR_ROUTING.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
					OBJECT_MAPPER_FOR_ROUTING.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
				}
		}
		return OBJECT_MAPPER_FOR_ROUTING;
	}
	
}
